cmake_minimum_required(VERSION 3.5.1)
project(AscendGaussBlur)
add_compile_options(-std=c++11)

set(common_compile_definitions
    _GLIBCXX_USE_CXX11_ABI=0
)

set(OpenCV_DIR /root/yolaw/opencv-ascend/lib64/cmake/opencv4)
find_package(OpenCV REQUIRED)

set(ASCEND_PATH /usr/local/Ascend/ascend-toolkit/latest)
INCLUDE_DIRECTORIES(
        ${OpenCV_INCLUDE_DIRS}
        ${ASCEND_PATH}/opp/op_proto/built-in/inc
        ${ASCEND_PATH}/fwkacllib/include/graph
        ${ASCEND_PATH}/fwkacllib/include/ge
        ${ASCEND_PATH}/fwkacllib/include/parser
        ${ASCEND_PATH}/fwkacllib/include/
)

add_executable(${PROJECT_NAME}
        main.cpp
        AscendGaussianBlur.cpp
        ModelProcess.cpp
        )

target_compile_definitions(${PROJECT_NAME} PRIVATE
    ${common_compile_definitions}
)

target_link_libraries(${PROJECT_NAME} PRIVATE
        -Wl,--no-as-needed
        ${ASCEND_PATH}/fwkacllib/lib64/stub/libgraph.so
        ${ASCEND_PATH}/fwkacllib/lib64/stub/libge_runner.so
        ${ASCEND_PATH}/fwkacllib/lib64/stub/libfmk_parser.so
        ${ASCEND_PATH}/fwkacllib/lib64/stub/libascendcl.so
        -Wl,--as-needed
        ${OpenCV_LIBS}
        pthread dl -Wl,-z,relro,-z,now,-z,noexecstack -pie -s stdc++
        )
